home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7644 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: newbie question concerning fread
  5. Date: Tue, 27 Feb 96 20:31:58 GMT
  6. Organization: none
  7. Distribution: inet
  8. Message-ID: <825453118snz@genesis.demon.co.uk>
  9. References: <rblayney.824643669@extro> <4gqejmINNh5@keats.ugrad.cs.ubc.ca>
  10. Reply-To: fred@genesis.demon.co.uk
  11. X-NNTP-Posting-Host: genesis.demon.co.uk
  12. X-Newsreader: Demon Internet Simple News v1.27
  13. X-Mail2News-Path: genesis.demon.co.uk
  14.  
  15. In article <4gqejmINNh5@keats.ugrad.cs.ubc.ca>
  16.            c2a192@ugrad.cs.ubc.ca "Kazimir Kylheku" writes:
  17.  
  18. >The two are equivalent, since in C, an "E1[E2]", where E1 and E2 are
  19. >expressions,  is the same as *((E1) + (E2)). One neat effect of this definition
  20. >is that if you have an array called 'a', and an index called 'i', you can refer
  21. >to the ith element as either a[i] or i[a].
  22.  
  23. But certainly not [a]i or [i]a
  24.  
  25. >Hence both of these constructs give the letter 'x':
  26.  
  27. >
  28. >        char x = "abcx"[3];
  29. >        char x = [3]"abcx";        /* This is a syntax error */
  30. >        char x = ["abcx"]3;        /* And so is this */
  31. >        char x = 3["abcx"];
  32.  
  33. -- 
  34. -----------------------------------------
  35. Lawrence Kirby | fred@genesis.demon.co.uk
  36. Wilts, England | 70734.126@compuserve.com
  37. -----------------------------------------
  38.